#include <string.h>
#include <time.h>
+\f
+
+/* Profiling stuff */
+
+#undef PROFILE_FILE_CHOOSER
+#ifdef PROFILE_FILE_CHOOSER
+#include <unistd.h>
+
+#define PROFILE_INDENT 4
+static int profile_indent;
+
+static void
+profile_add_indent (int indent)
+{
+ profile_indent += indent;
+ if (profile_indent < 0)
+ g_error ("You screwed up your indentation");
+}
+
+void
+_gtk_file_chooser_profile_log (const char *func, int indent, const char *msg1, const char *msg2)
+{
+ char *str;
+
+ if (indent < 0)
+ profile_add_indent (indent);
+
+ if (profile_indent == 0)
+ str = g_strdup_printf ("MARK: %s %s %s", func, msg1 ? msg1 : "", msg2 ? msg2 : "");
+ else
+ str = g_strdup_printf ("MARK: %*c %s %s %s", profile_indent - 1, ' ', func, msg1 ? msg1 : "", msg2 ? msg2 : "");
+
+ access (str, F_OK);
+ g_free (str);
+
+ if (indent > 0)
+ profile_add_indent (indent);
+}
+
+#define profile_start(x, y) _gtk_file_chooser_profile_log (G_STRFUNC, PROFILE_INDENT, x, y)
+#define profile_end(x, y) _gtk_file_chooser_profile_log (G_STRFUNC, -PROFILE_INDENT, x, y)
+#define profile_msg(x, y) _gtk_file_chooser_profile_log (NULL, 0, x, y)
+#else
+#define profile_start(x, y)
+#define profile_end(x, y)
+#define profile_msg(x, y)
+#endif
+
+\f
+
typedef struct _GtkFileChooserDefaultClass GtkFileChooserDefaultClass;
#define GTK_FILE_CHOOSER_DEFAULT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_FILE_CHOOSER_DEFAULT, GtkFileChooserDefaultClass))
gboolean result;
GtkFilePath *path_copy;
+ profile_start ("start", (char *) path);
+
/* We copy the path because of this case:
*
* list_row_activated()
gtk_file_path_free (path_copy);
+ profile_end ("end", (char *) path);
+
return result;
}
{
GtkTreeIter iter;
+ profile_start ("start", NULL);
+
if (!gtk_tree_model_get_iter_first (GTK_TREE_MODEL (impl->shortcuts_model), &iter))
- return;
+ goto out;
do {
gpointer data;
g_object_unref (pixbuf);
}
} while (gtk_tree_model_iter_next (GTK_TREE_MODEL (impl->shortcuts_model),&iter));
+
+ out:
+
+ profile_end ("end", NULL);
}
static void
GtkFileInfo *info;
GError *tmp = NULL;
+ profile_start ("start", (char *) path);
+
parent_path = NULL;
info = NULL;
g_error_free (tmp);
}
+ profile_end ("end", (char *) path);
+
return info;
}
{
GtkFileFolder *folder;
+ profile_start ("start", (char *) path);
+
folder = gtk_file_system_get_folder (file_system, path, 0, error);
if (!folder)
- return FALSE;
+ {
+ profile_end ("end - is not folder", (char *) path);
+ return FALSE;
+ }
g_object_unref (folder);
+
+ profile_end ("end", (char *) path);
return TRUE;
}
gpointer data;
GtkTreeIter iter;
+ profile_start ("start", is_volume ? "volume" : (char *) path);
+
if (is_volume)
{
data = volume;
else
{
if (!check_is_folder (impl->file_system, path, error))
- return FALSE;
+ {
+ profile_end ("end - is not folder", NULL);
+ return FALSE;
+ }
if (label)
label_copy = g_strdup (label);
GtkFileInfo *info = get_file_info (impl->file_system, path, TRUE, error);
if (!info)
- return FALSE;
+ {
+ profile_end ("end - could not get info", (char *) path);
+ return FALSE;
+ }
label_copy = g_strdup (gtk_file_info_get_display_name (info));
gtk_file_info_free (info);
if (pixbuf)
g_object_unref (pixbuf);
+ profile_end ("end", NULL);
+
return TRUE;
}
GtkFilePath *home_path;
GError *error;
+ profile_start ("start", NULL);
+
home = g_get_home_dir ();
if (home == NULL)
- return;
+ {
+ profile_end ("end - no home directory!?", NULL);
+ return;
+ }
home_path = gtk_file_system_filename_to_path (impl->file_system, home);
error_getting_info_dialog (impl, home_path, error);
gtk_file_path_free (home_path);
+
+ profile_end ("end", NULL);
}
/* Appends the ~/Desktop directory to the shortcuts model */
char *name;
GtkFilePath *path;
+ profile_start ("start", NULL);
+
#ifdef G_OS_WIN32
name = _gtk_file_system_win32_get_desktop ();
#else
const char *home = g_get_home_dir ();
if (home == NULL)
- return;
+ {
+ profile_end ("end - no home directory!?", NULL);
+ return;
+ }
name = g_build_filename (home, "Desktop", NULL);
#endif
*/
gtk_file_path_free (path);
+
+ profile_end ("end", NULL);
}
/* Appends a list of GtkFilePath to the shortcuts model; returns how many were inserted */
int num_inserted;
gchar *label;
+ profile_start ("start", NULL);
+
/* As there is no separator now, we want to start there.
*/
start_row = shortcuts_get_index (impl, SHORTCUTS_BOOKMARKS_SEPARATOR);
g_free (label);
}
+ profile_end ("end", NULL);
+
return num_inserted;
}
int n;
gboolean old_changing_folders;
+ profile_start ("start", NULL);
+
old_changing_folders = impl->changing_folder;
impl->changing_folder = TRUE;
gtk_tree_model_filter_refilter (GTK_TREE_MODEL_FILTER (impl->shortcuts_filter_model));
impl->changing_folder = old_changing_folders;
+
+ profile_end ("end", NULL);
}
/* Inserts a separator node in the shortcuts list */
GtkFilePath *combo_selected = NULL;
gboolean is_volume;
gpointer col_data;
+
+ profile_start ("start", NULL);
old_changing_folders = impl->changing_folder;
impl->changing_folder = TRUE;
}
impl->changing_folder = old_changing_folders;
+
+ profile_end ("end", NULL);
}
/* Appends a separator and a row to the shortcuts list for the current folder */
{
GtkFileChooserDefault *impl;
+ profile_start ("start", NULL);
+
impl = GTK_FILE_CHOOSER_DEFAULT (widget);
if (GTK_WIDGET_CLASS (parent_class)->style_set)
change_icon_theme (impl);
g_signal_emit_by_name (widget, "default-size-changed");
+
+ profile_end ("end", NULL);
}
static void
{
GtkFileChooserDefault *impl;
+ profile_start ("start", NULL);
+
impl = GTK_FILE_CHOOSER_DEFAULT (widget);
GTK_WIDGET_CLASS (parent_class)->map (widget);
}
bookmarks_changed_cb (impl->file_system, impl);
+
+ profile_end ("end", NULL);
}
static gboolean
{
GtkFileChooserDefault *impl;
+ profile_start ("start", NULL);
+
GDK_THREADS_ENTER ();
impl = GTK_FILE_CHOOSER_DEFAULT (data);
GDK_THREADS_LEAVE ();
+ profile_end ("end", NULL);
+
return FALSE;
}
gboolean have_hidden;
gboolean have_filtered;
+ profile_start ("start", NULL);
+
if (!only_one_path && !paths)
- return TRUE;
+ {
+ profile_end ("end", NULL);
+ return TRUE;
+ }
folder = gtk_file_system_get_folder (impl->file_system, parent_path, GTK_FILE_INFO_IS_HIDDEN, error);
if (!folder)
- return FALSE;
+ {
+ profile_end ("end", NULL);
+ return FALSE;
+ }
success = FALSE;
have_hidden = FALSE;
g_object_unref (folder);
if (!success)
- return FALSE;
+ {
+ profile_end ("end", NULL);
+ return FALSE;
+ }
if (have_hidden)
g_object_set (impl, "show-hidden", TRUE, NULL);
}
}
+ profile_end ("end", NULL);
return TRUE;
}
browse_files_model_finished_loading_cb (GtkFileSystemModel *model,
GtkFileChooserDefault *impl)
{
+ profile_start ("start", NULL);
+
if (impl->load_state == LOAD_PRELOAD)
{
load_remove_timer (impl);
/* We can't g_assert_not_reached(), as something other than us may have
* initiated a folder reload. See #165556.
*/
+ profile_end ("end", NULL);
return;
}
pending_select_paths_process (impl);
set_busy_cursor (impl, FALSE);
+
+ profile_end ("end", NULL);
}
/* Gets rid of the old list model and creates a new one for the current folder */
{
g_assert (impl->current_folder != NULL);
+ profile_start ("start", NULL);
+
load_remove_timer (impl); /* This changes the state to LOAD_EMPTY */
if (impl->browse_files_model)
if (!impl->browse_files_model)
{
set_busy_cursor (impl, FALSE);
+ profile_end ("end", NULL);
return FALSE;
}
install_list_model_filter (impl);
+ profile_end ("end", NULL);
+
return TRUE;
}
GtkFileChooserDefault *impl = GTK_FILE_CHOOSER_DEFAULT (chooser);
gboolean result;
+ profile_start ("start", (char *) path);
+
g_assert (path != NULL);
if (impl->local_only &&
GTK_FILE_CHOOSER_ERROR_BAD_FILENAME,
_("Cannot change to folder because it is not local"));
+ profile_end ("end - not local", (char *) path);
return FALSE;
}
/* Test validity of path here. */
if (!check_is_folder (impl->file_system, path, error))
- return FALSE;
+ {
+ profile_end ("end - not a folder", (char *) path);
+ return FALSE;
+ }
if (!_gtk_path_bar_set_path (GTK_PATH_BAR (impl->browse_path_bar), path, keep_trail, error))
- return FALSE;
+ {
+ profile_end ("end - could not set path bar", (char *) path);
+ return FALSE;
+ }
if (impl->current_folder != path)
{
g_signal_emit_by_name (impl, "selection-changed", 0);
+ profile_end ("end", NULL);
return result;
}
GdkPixbuf *pixbuf;
const GtkFileInfo *info;
gboolean sensitive = TRUE;
+
+ profile_start ("start", NULL);
info = get_list_file_info (impl, iter);
if (pixbuf)
g_object_unref (pixbuf);
+
+ profile_end ("end", NULL);
}
static void